package com.itheima.sh.controller;

import com.itheima.sh.client.UserFeignApi;
import com.itheima.sh.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Feign 远程调用
 */
@RestController
@RequestMapping("feign")
public class FeignController {

    @Autowired
    UserFeignApi userFeignApi;  // 代理对象， 实现子类存到 IOC容器中


    @GetMapping("{id}")
    public User findUser(@PathVariable("id") String username) {

        return userFeignApi.queryById(username);
    }


}
